1. Field of the Invention
The present invention relates in general to the field of information modeling using the Unified Modeling Language (UML), and in particular to a method for modeling reflexive inverse associations via the Unified Modeling Language (UML).
2. Description of Related Art
For ease of understanding and clarity, the terms that will be used hereinafter are defined as follows.
The Unified Modeling Language (UML) is a language used for defining models of software and information systems. In UML, a model is a package of model elements, such as classes, associations, and generalizations.
A “class” is a classification of objects. An “object” is an abstract representation of a concept or a thing. For example, a class called BankAccount can be a classification of objects representing individual accounts in a banking system. Another class, Customer, can classify objects representing customers.
An “association” is a classification of links. A “link” represents a relationship between objects. An association has two or more ends that specify the types of objects that can be related. A link of an association has one object for each end representing that a relationship occurs between the linked objects. A “binary association” is an association with two ends such that each link relates an object represented by one end to an object represented by the other end.
A “generalization” specifies that one classification is a subclassification of another. For example, a class Customer could be a subclassification of another class Person. The meaning of the generalization in this case is that every Customer object is also a Person object. A generalization can also occur between two associations, indicating that every link of a specific association is also a link of a more general association. Generalization of associations occurs where a relationship represented by a link of a specific association is stated more generally as a relationship of a general association. For example, a parent-to-child association is a generalization of a father-to-child association, since every father-to-child link is, at the same time, a parent-to-child link. A generalization between two associations requires that there be a correspondence, called “end redefinition” between the ends of the two associations. Each end of a general association is redefined by an end of a specific association. In the example above, the father end of the father-to-child association redefines the parent end of the parent-to-child association, and the child end of the father-to-child association redefines the child end of the parent-to-child association. Based on the end redefinitions, the father in a father-to-child link is the parent (and not the child) in a parent-to-child link.
A class or an association (also denoted by the general term “classifier”) can be modeled as “abstract”, meaning that the classification is an incomplete specification such that any instance (object or link) must also be an instance of some other classifier having the abstract classifier as a generalization.
UML associations provide an important capability for representing information in that relationships between objects are seen from perspectives of each object. For example, a parent-to-child relationship is, from the inverse perspective, a child-to-parent relationship. An association captures both perspectives at the same time. A parent-to-child link is at the same time a child-to-parent link.
However, UML associations fall short of modeling reflexive inverse relationships, which are binary relationships where both ends represent the same role. For example, a parent-to-child relationship is easily modeled, but relative-to-relative relationship is not. Or, husband-to-wife relationship is easily modeled, but spouse-to-spouse is not. The problem arises because each end of an association is distinct. The two ends of a binary association cannot be the same end.
Because of this problem, reflexive inverse relationships tend to be only partially modeled in UML. The partial model is an association having a named end and an unnamed end. For example, a relative-to-relative relationship is modeled as an association with one end named relative, and no name on the other end. But this model is incomplete because it fails to capture important semantics, which are, first, that the inverse of relative is relative, and second, that a link representing a first Person being a relative of a second Person is at the same time a link representing the second Person being a relative of the first Person.
The lack of a method to capture the semantics of reflexive inverse relationships in UML limits what can be expressed in models for human understanding. More importantly, since automatic generation from UML models is an important part of modern software development process, this limitation also prevents proper generation of software and databases from UML models.
Outside of UML there is another approach to modeling relationships used in semantic data modeling and used by some metadata repositories that supports reflexive inverse relationships. This approach does not model relationships as classifications of links, but rather it models references from one object to another. A reference specified for a class can be related to another reference (in the same class or another) that represents the inverse perspective on the same relationship. For example, a parent reference in a Person class can be the inverse of a child reference in a Person class. This approach to modeling relationships allows a reference to be its own inverse. However, this approach is not compatible with UML modeling of associations, nor does it capture the important UML concept that relationships can be classified and generalized.
There is a need for a method to support modeling of reflexive inverse relationships in UML using associations that can be classified and generalized. The semantics of reflexive inverse relationships must be captured in the structure of a model so that automatic generation tools can generate correct software and databases. There is also a need to be able to easily translate reflexive inverse relationships from semantic data models into UML associations.